package kr.hkit.powerjava.chapter25;

import java.net.*;
import java.io.*;

public class ParseURL {
	public static void main(String[] args) {
		try{
			StringBuilder sb = new StringBuilder();
			URL myURL = new URL("http://hkit.kr/SUB/?ctId=49&eduCode=00000027");
			sb.append("protocal="+myURL.getProtocol()+"\n");
			sb.append("authority="+myURL.getAuthority()+"\n");
			sb.append("port="+myURL.getPort()+"\n");
			sb.append("host="+myURL.getHost()+"\n");
			sb.append("path="+myURL.getPath()+"\n");
			sb.append("query="+myURL.getQuery()+"\n");
			
			
			BufferedReader in = new BufferedReader(new InputStreamReader(myURL));
			
		}catch( MalformedURLException e){
			System.out.println("잘못된 주소입니다.");
		}
	}

}
